#!/bin/bash

workdir="/home/rhome/wangyong/zhaolingci_io4/Go-DCL1-A/ana/kinetic"
GNU="/home/rhome/wangyong/software/Gnuplot4.5/bin"

 if [ $# -lt 1 ]; then
 echo "$0 tmppdb"
else
  PDB=$1
fi
cat > TRAN.SGE <<EOF
#$ -S /bin/bash
#$ -cwd
#$ -V
#$ -N transition
# $workdir/contactPHI.x $workdir/binding73.list $PDB qnative.list
  $workdir/conTran.x $workdir/binding73.list $workdir/folding_csu.list $PDB qnative.list
  $workdir/addResnum.x qnative.list $workdir/forTOPca.pdb
##
  $GNU/gnuplot $workdir/contactMaps.bat
  $workdir/turn2ResProb.x
  $GNU/gnuplot $workdir/ResidueNumber.bat
##RNA##
  $workdir/turn2RNAProb.x
  $workdir/addRNA.x rNACutoff-5.5-9.5.dat $workdir/forTOPca.pdb
  echo "atom  Phosphate p      res" >P.dat
  grep "P" RNAs.dat >>P.dat
  echo "atom    Sugar   s     res" >S.dat
  grep "S" RNAs.dat >>S.dat
  echo "atom    Base    b     res" >B.dat
  grep "B" RNAs.dat >>B.dat
  $GNU/gnuplot $workdir/plotHistograms.bat
EOF
  qsub TRAN.SGE
